package archer.framework.core.constant;

import archer.framework.core.ArcherCoreModule;
import archer.framework.utils.MapUtils;

import java.util.Map;

/**
 * 常量定义
 *
 * @author christ
 * @date 2016/3/31
 */
public interface Constant {

    /**
     * Entity默认值配置
     */
    class EntityDefault {

        public static final String Y = ArcherCoreModule.databaseBooleanTrue;

        public static final String N = ArcherCoreModule.databaseBooleanFalse;

        private static final Map description = MapUtils.asMap(Y, "是", N, "否");

        static {
            ConstantDescription.register(EntityDefault.class.getSimpleName(), EntityDefault.description);
        }
    }

    /**
     * 过滤规则
     */
    class FilterRule {

        public static final String EQ = "eq";

        public static final String NE = "ne";

        public static final String IN = "in";

        public static final String NIN = "nin";

        public static final String GT = "gt";

        public static final String GE = "ge";

        public static final String LT = "lt";

        public static final String LE = "le";

        public static final String LIKE = "like";

        public static final String STARTS = "starts";

        public static final String ENDS = "ends";
    }

    /**
     * 排序方向
     */
    class OrderDirection {

        public static final String DESC = "desc";

        public static final String ASC = "asc";
    }

    /**
     * 可疑事件威胁等级
     */
    class SuspiciousLevel {

        public static final String RED = "RED";

        public static final String ORANGE = "ORANGE";

        private static final Map description = MapUtils.asMap(RED, "红色", ORANGE, "橙色");

        static {
            ConstantDescription.register(SuspiciousLevel.class.getSimpleName(), SuspiciousLevel.description);
        }
    }

    /**
     * 可疑事件类型
     */
    class SuspiciousType {

        public static final String ILLEGAL_IP = "ILLEGAL_IP";

        public static final String ILLEGAL_API_TENANT = "ILLEGAL_API_TENANT";

        private static final Map description = MapUtils.asMap(ILLEGAL_IP, "ip refused", ILLEGAL_API_TENANT, "api tenant error");

        static {
            ConstantDescription.register(SuspiciousType.class.getSimpleName(), SuspiciousType.description);
        }
    }
}
